<?php

/**
 * This is the model class for table "{{tqq_user}}".
 *
 * The followings are the available columns in table '{{tqq_user}}':
 * @property integer $id
 * @property string $uname
 * @property string $ot
 * @property string $ots
 * @property string $openid
 * @property string $openkey
 * @property string $appkey
 * @property string $info
 * @property integer $otime
 */
class TqqUser extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return TqqUser the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{tqq_user}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('uname, ot, ots, openid, openkey, appkey, info, otime', 'required'),
			array('otime', 'numerical', 'integerOnly'=>true),
			array('uname', 'length', 'max'=>32),
			array('ot, ots, openid, openkey, appkey, info', 'length', 'max'=>64),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, uname, ot, ots, openid, openkey, appkey, info, otime', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'uname' => 'Uname',
			'ot' => 'Ot',
			'ots' => 'Ots',
			'openid' => 'Openid',
			'openkey' => 'Openkey',
			'appkey' => 'Appkey',
			'info' => 'Info',
			'otime' => 'Otime',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('uname',$this->uname,true);
		$criteria->compare('ot',$this->ot,true);
		$criteria->compare('ots',$this->ots,true);
		$criteria->compare('openid',$this->openid,true);
		$criteria->compare('openkey',$this->openkey,true);
		$criteria->compare('appkey',$this->appkey,true);
		$criteria->compare('info',$this->info,true);
		$criteria->compare('otime',$this->otime);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}